<template>
	<div class="page">
		<div class="save-header">
			<p class="back" @click="clickBack"><Icon type="ios-arrow-back"></Icon></p>
			<p class="name">{{$route.params.detail.name}}</p>
			<p class="phone">{{$route.params.detail.phoneNum}}</p>
		</div>
		<div class="search-view">
			<Input v-model="search" icon="ios-search"  placeholder="请输入物品名称" style="width: 3rem"></Input>
		</div>
		<div class="list-view">
			<XSaveListView 
			:data="saveDetaiData"></XSaveListView>
		</div>
	</div>
</template>

<script>
import $ from 'jquery'
import XSaveListView from '@/pages/save/view/XSaveListView'
import saveService from '@/network/service/saveService.js'

export default {
	components: {
		XSaveListView
	},
	data() {
		return {
			search: '',
			saveDetaiData: {
				isLoading: false,
				data: [],
				listType: 'detail',
				page: {
					currentPage: 0,
					pagesize: 20,
					totalSize: 0
				}
			},
		}
	},
	mounted() {
		let input = $('.ivu-input');
		let table = $('.ivu-table');
		let select = $('.ivu-select');
		let pageInput = $('.ivu-page-options-elevator input');
		for(let i = 0; i < input.length; i++) {
			input[i].style.color = 'rgba(255, 255, 255, 0.6)'
		}
		for(let i = 0; i < table.length; i++) {
			table[i].style.color = 'rgba(255, 255, 255, 0.6)'
		}
		for(let i = 0; i < select.length; i++) {
			select[i].style.color = 'rgba(255, 255, 255, 0.6)'
		}
		for(let i = 0; i < pageInput.length; i++) {
			pageInput[i].style.color = 'rgba(255, 255, 255, 0.6)'
		}
		this.getDepositDetails();
	},
	methods: {
		clickBack() {
			this.$router.replace({
				name: 'XSavePage'
			})
		},
		getDepositDetails() {
			let params = {
				did: this.$route.params.detail.did,
				paging: 1,
				page: this.saveDetaiData.page.currentPage,
				pageSize: this.saveDetaiData.page.pagesize,
				key: this.saveDetaiData.page.key
			}
			saveService.getDepositDetails(params).then(res => {
				let result = res.data;
				let code = result.rescode;
				let resmsg = result.msg;
				if (code == 100) {
					this.saveDetaiData.data = result.data;
					this.saveDetaiData.page.totalSize = result.totalSize;
				} else {
					this.$Message.error(resmsg);
				}
			}, error => {
				this.$Message.error('服务器异常，请稍后再试')
			})
		}
	}
}
</script>

<style scoped lang="less">
.page {
	padding: .1rem .1rem 0 .1rem;
	color: rgba(255, 255, 255, 0.6);
	.save-header {
		display: flex;
		margin-bottom: .4rem;
		p {
			margin-right: .2rem;
			height: .4rem;
			line-height: .4rem;
		}
		.name {
			font-size: .2rem;
		}
		.back {
			font-size: .2rem;
			width: .3rem;
			margin-right: 0;
			cursor: pointer;
		}
	}
	.search-view {
		margin-bottom: .4rem;
	}
}
</style>